#ifndef __TI_COMMAND_FS_H__
#define __TI_COMMAND_FS_H__

typedef enum _BtFsType
{
	BT_FS_FILE,
	BT_FS_DIR
} BtFsType;

typedef struct _BTFsStat
{
	BtFsType		 type;				/* file / dir */
	unsigned long	 size;				/* in bytes */
	FileAccessMode	 access;	        /* permission access */
	int 	         mTime;				/* modified time */
	int 	         aTime;				/* accessed time */
	int 	         cTime;				/* creation time */
} BTFsStat;

typedef enum _BtFsSeekOrigin
{
	BT_FS_CUR,	/* from current position */
	BT_FS_END,	/* from end of file */
	BT_FS_START	/* from start of file */
} BtFsSeekOrigin;

#define BT_FS_O_WRONLY   0x00000001      /* write only */
#define BT_FS_O_CREATE   0x00000002      /* create only */
#define BT_FS_O_TRUNC    0x00000004      /* if file already exists and it is opened for writing, its length is truncated to zero. */
#define BT_FS_O_APPEND   0x00000008     /* append to EOF */
#define BT_FS_O_RDONLY   0x00000010      /* read only */
#define BT_FS_O_RDWR     0x00000020     /* read & write */
#define BT_FS_O_EXCL     0x00000040      /* generate error if BT_FS_O_CREATE is also specified and the file already exists.*/
#define BT_FS_O_BINARY   0x00000080      /* binary file */
#define BT_FS_O_TEXT     0x00000100      /* text file */


EXTERN_C int TICommandFsInit();
EXTERN_C int TICommandFsDeInit();
EXTERN_C int TICommandFsOpen(char* fullPathFileName, int flags, int *p);
EXTERN_C int TICommandFsClose( int fd );
EXTERN_C int TICommandFsRead ( int fd, void* buf, unsigned int nSize, unsigned int *pnReadedSize);
EXTERN_C int TICommandFsWrite( int fd, void* buf, unsigned int nSize, unsigned int *pnWritedSize);
EXTERN_C int TICommandFsRemove( char *fullPathFileName );
EXTERN_C int TICommandFsFlush( int fd );
EXTERN_C int TICommandFsStat( char* fullPathName, BTFsStat* fileStat );
EXTERN_C int TICommandFsTell( int fd, unsigned int *curPosition );
EXTERN_C int TICommandFsSeek( int fd, int offset, BtFsSeekOrigin from );
EXTERN_C int TICommandFsMkdir( char *dirFullPathName );
EXTERN_C int TICommandFsRmdir( char *dirFullPathName );
EXTERN_C int TICommandFsOpenDir( char *dirFullPathName, int *dirDesc );
EXTERN_C int TICommandFsReadNextDir( int dirDesc, char *fileName );
EXTERN_C int TICommandFsCloseDir( int dirDesc );
EXTERN_C int TICommandFsRename(char *fullPathOldName, char *fullPathNewName );

#endif //__TI_COMMAND_FS_H__
